using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player_Combat : Entity_Combat
{
    [Space]
    [SerializeField] private float counterAttackDuration = 0.2f;
    private bool hasCounteredSomeBody = false;
    [SerializeField] private LayerMask whatIsCounter;
    //判断玩家是否能够反击
    public bool CounterAttackPerformed()
    {
        hasCounteredSomeBody = false;
        foreach (var target in GetDetectedColliders(whatIsCounter))
        {
            ICounterable counterable = target.GetComponent<ICounterable>();
            if (counterable != null && counterable.CanStunned)
            {
                counterable.HanderCounter();
                hasCounteredSomeBody = true;
            }
        }
        return hasCounteredSomeBody;
    }
    public float GetCounterAttackDuration() => counterAttackDuration;
}
